<!DOCTYPE html>
<html lang="zh-cmn-Hans">

<head>
	<meta charset="UTF-8">
	<!-- <link rel="icon" type="image/svg+xml" href="/favicon.svg"> -->
	<meta content="yes" name="apple-mobile-web-app-capable" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
	<meta name="wpk-bid" content="dta_2_137895" />
	<link rel="apple-touch-icon" href="/favicon.ico">
	<link rel="manifest" href="/manifest.json">
	<title>53AI Hub</title>
	<script>	</script>
</head>

<!-- <body class="dark:bg-black"> -->
<body>
	<style>
		body {
			--ball-color: #4b9e5f;
			height: 100%;
			overflow: hidden;
		}
		body.is-mask {
			width: 100vw;
			height: 100vh;
			background-color: rgba(0, 0, 0, 0.3);
			--ball-color: rgba(37, 99, 235, 1);
		}
			.loader-wrapper {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 100vw;
				height: 100vh;
			}
			.balls {
				width: 4em;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;
				justify-content: space-between;
			}
			.balls div {
				width: 0.8em;
				height: 0.8em;
				border-radius: 50%;
				background-color: var(--ball-color);
			}
			.balls div:nth-of-type(1) {
				transform: translateX(-100%);
				animation: left-swing 0.5s ease-in alternate infinite;
			}
			.balls div:nth-of-type(3) {
				transform: translateX(-95%);
				animation: right-swing 0.5s ease-out alternate infinite;
			}

			@keyframes left-swing {

				50%,
				100% {
					transform: translateX(95%);
				}
			}

			@keyframes right-swing {
				50% {
					transform: translateX(-95%);
				}

				100% {
					transform: translateX(100%);
				}
			}

			/* @media (prefers-color-scheme: dark) {
				body {
					background: #121212;
				}
			} */
	</style>
	<div id="app">
		<div class="loader-wrapper">
			<div class="balls">
				<div></div>
				<div></div>
				<div></div>
			</div>
		</div>
	</div>

	<script>
		function getSearchParam() {
		  const search = location.search.split('?')[1] || ''
		  const reg = /([^?&=]+)=([^?&=]+)/g
		  const params = {}
		  search.match(reg)?.forEach((item) => {
		    const [key, value] = item.split('=')
		    params[key] = value
		  })
		  return params
		}
		function joinSearchParam(params = {}) {
		  let search = ''
		  Object.keys(params).forEach((key) => {
		    search += `${key}=${params[key]}&`
		  })
		  if (search)
    search = `?${search}`
		  return search
		}
		const search_params = getSearchParam()
		if (search_params.api_host) window.api_host = `http://${search_params.api_host.replace(/^https?:\/\//, '').replace(/\/$/, '')}`
		if (search_params.qyy_host) window.qyy_host = `http://${search_params.qyy_host.replace(/^https?:\/\//, '').replace(/\/$/, '')}`
		const provider_type = location.search.includes('provider_type') ? location.search.split('provider_type=')[1] : ''
		const provider_id = location.search.includes('provider_id') ? location.search.split('provider_id=')[1] : ''
		const is_authorized = location.search.includes('is_authorized') ? location.search.split('is_authorized=')[1] : ''
		if (search_params.provider_type) {
			if (window.opener) {
				window.opener.postMessage({
					provider_type: search_params.provider_type,
					provider_id: search_params.provider_id,
					is_authorized: search_params.is_authorized,
				}, '*')
			} else {
				window.postMessage({
					provider_type: search_params.provider_type,
					provider_id: search_params.provider_id,
					is_authorized: search_params.is_authorized,
				}, '*')
			}
		}
		if (search_params.access_token) {
		  localStorage.removeItem('access_token')
		  localStorage.removeItem('user_info')
		  localStorage.setItem('access_token', search_params.access_token)
		  localStorage.setItem('user_info', JSON.stringify({
		    access_token: search_params.access_token,
		    user_id: '',
		    eid: search_params.eid,
		  }))
		  delete search_params.access_token
		  delete search_params.eid
			if (search_params.from_origin) {
				sessionStorage.setItem('from_origin', decodeURIComponent(search_params.from_origin))
				delete search_params.from_origin
			}
		  location.search = joinSearchParam(search_params)
		}
	</script>
	<script type="module" src="/src/main.ts"></script>
	<script>
	var _hmt = _hmt || [];
	(function() {
		var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?c0e32ea294a4fc371fe6ec64187e36e1";
		var s = document.getElementsByTagName("script")[0];
		s.parentNode.insertBefore(hm, s);
	})();
	</script>
</body>

</html>
